|
|
 |
|
|
|
|
ByVal x1 As Single, ByVal y1 As Single, _
ByVal x4 As Single, ByVal y4 As Single)
Dim x2 As Single
Dim y2 As Single
Dim x3 As Single
Dim y3 As Single
' Find the corners of the middle square. x2 = (2 * x1 + x4) * 0.3333
x3 = (x1 + 2 * x4) * 0.3333
y2 = (2 * y1 + y4) * 0.3333
y3 = (y1 + 2 * y4) * 0.3333
' Erase the middle rectangle. picCanvas.Line (x2, y2)-(x3, y3), picCanvas.BackColor, BF
' Recursively erase other rectangles. If depth > 0 Then
SierpinskiErase depth - 1, x1, y1, x2, y2
SierpinskiErase depth - 1, x2, y1, x3, y2
SierpinskiErase depth - 1, x3, y1, x4, y2
SierpinskiErase depth - 1, x1, y2, x2, y3
SierpinskiErase depth - 1, x3, y2, x4, y3
SierpinskiErase depth - 1, x1, y3, x2, y4
SierpinskiErase depth - 1, x2, y3, x3, y4
SierpinskiErase depth - 1, x3, y3, x4, y4
End If
End Sub |
|
|
|
|
|
|
|
|
Example program SierpBox uses this routine to create gaskets like the one shown in Figure 10.29. This object is known as the Sierpinski carpet or the Sierpinski box. |
|
|
|
|
|
|
|
|
The Mandelbrot set is probably the most widely recognized fractal. Its ever-changing whorls, twists, spikes, and ridges give it an alien beauty that makes it a popular subject |
|
|
|
|
|
|
|
|
Figure 10.29
A Sierpinski carpet. |
|
|
|
|
|